﻿Ext.define('app.prm.task.edit.Basic', {
    extend: 'Ext.Panel',
    taskId: 0,
    border: true,
    autoHeight: true,
    initComponent: function () {
        var me = this;
        this.items = [me.getTaskInfo()];
        me.callParent();
    },
    getTaskInfo: function () {
        var me = this;
        if (!this.prminfo) {
            this.prminfo = new Ext.Panel(
            {
                border: false,
                height: 150,
                style: 'border-top-width: 0px;border-right-width:1px;border-bottom-width:0px;border-left-width:0px'
            });
        }
        return this.prminfo;
    },
    getInfoTpl: function () {
        if (!this.basictpl) {
            this.basictpl = new Ext.XTemplate(
                 '<div style="padding:5px"><span style="font-family:应用字体;color:#004080;font-size:12pt;font-weight:bold;">{title} ({percentDone}%) {startDate} - {endDate}</span></div>',
                '<div style="padding:5px"><span style="font-family:应用字体;color:#333333;font-size:9.5pt;">成员：{participants}</div>',
                '<div style="padding:5px"><span style="font-family:应用字体;color:#333333;font-size:9.5pt;">描述：{note}</span></div>',
                '<div style="padding:5px"><span style="font-family:应用字体;color:#333333;font-size:9.5pt;">创建者：{createBy} 创建时间：{createOn}</span></div>'
            );
        }
        return this.basictpl;
    },
    listeners:
        {
            afterrender: function (me) {
                App.AjaxGet('/api/services/app/gantt/Get?taskId=' + me.taskId, function (data) {
                    var result = data.result;
                    me.getInfoTpl().overwrite(me.getTaskInfo().body, result);
                });
            }
        }
});